<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use common\models\Order;

/* @var $this yii\web\View */
/* @var $model common\models\Order */

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => '订单', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="order-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('更改', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?= Html::a('删除', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Are you sure you want to delete this item?',
                'method' => 'post',
            ],
        ]) ?>
    </p>

<div style="background:#3C8DBC;height:30px;border-radius:5px;">
                <h3 class="panel-title text-center" style="line-height:30px;color:white;">商品信息 </h3>
            </div>
            
     <table class="table table-striped table-bordered">
   <tbody>
<tr>
    <th>订单id</th><td><?=Html::encode($model->id)?></td>
    <th>用户名</th><td><?php echo $model->user_id ? $model->user->username : '';?></td>
</tr>
<tr>
    <th>订单状态1</th><td><?=Html::encode(Order::itemAlias("order_status",$model->order_status));?></td>
     <th>支付金额</th><td><?=Html::encode($model->pay_fee)?></td>
</tr>
<tr>
    <th>支付状态</th><td><?=Html::encode(Order::itemAlias("pay_status",$model->pay_status));?></td>
    <th>商品数量</th><td><?=Html::encode($model->product_num)?></td>
</tr>
<tr>
    <th>商品金额</th><td><?=Html::encode($model->product_fee)?></td>
    <th>配送状态</th>
     <td><?=Html::encode(Order::itemAlias("shipping_status",$model->shipping_status));?></td>
    </tr>
<tr>
    <th>配送费用</th><td><?=Html::encode($model->shipping_fee)?></td>
    <th>订单金额</th><td><?=Html::encode($model->order_fee)?></td>
</tr>
<th>订单留言</th><td><?=Html::encode($model->message)?></td></tr>
</tbody>
</table>
</div>


            <div style="background:#3C8DBC;height:30px;border-radius:5px;">
                <h3 class="panel-title text-center" style="line-height:30px;color:white;">订单信息 </h3>
            </div>
           
                 <table class="table table-striped table-bordered">
                    <thead>
                    <tr>
                        <td class="text-left">商品</td>
                        <td class="text-left">商品图片</td>
                        <td class="text-right">数量</td>
                        <td class="text-right">单品价格</td>
                        <td class="text-right">总价</td>
                        
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="orderGoods" id="good">
                   
                       <?php foreach ($list as $key => $value):?>
                           
                       
                  
                        <tr>
                        <?php foreach ($value['product'] as $key => $value1): ?>
                        <td class="text-right" style="width:100px;"><a href="http://www.tianpinwang.com.cn/product/<?= Html::encode($value1['id'])?>"><?= Html::encode($value1['name'])?></a></td>
                        <td class="text-right" ><img alt="" src="<?= Html::encode($value1['img_url'])?>" width="100px" height="100px"></td>
                        <?php endforeach ?>
                        <td class="text-right"><?= Html::encode($value['product_num'])?></td>
                        <td class="text-right"><?= Html::encode($value['price'])?></td>
                        <td class="text-right"><?= Html::encode($value['total_price'])?></td>
                      
                       </tr>
                       <?php endforeach ?>
                    
                    </volist>

                    <tr>
                        <td colspan="4" class="text-right">小计:</td>
                        <td class="text-right"><?=Html::encode($model->order_fee)?></td>
                    </tr>
                    </tbody>
                </table>


           <div style="background:#3C8DBC;height:30px;border-radius:5px;">
                <h3 class="panel-title text-center" style="line-height:30px;color:white;">收货信息 </h3>
            </div>
         
               <table class="table table-striped table-bordered">
                    <tbody><tr>
                    <td>收货人:</td>
                    <td>联系方式:</td>
                    <td>地址:</td>
                    <td>配送方式:</td>
                    <td>订单生成时间:</td>
                   </tr>
                <tr>
                        <td><?= Html::encode($model->address->name);?></td>
                        <td><?= Html::encode($model->address->phone);?></td>
                        <td><?=Html::encode($model->address_list($model->user_id, $model->address_id))?></td>
                       <td><span class="not-set">平台配送<!-- <?php echo $model->shipping_id ? $model->shipping->shipping_name : '';?> --></span></td>
                        <td><?=Html::encode($model->create_time)?></td>

                </tr>
                    </tbody>
                </table>
        


            <div style="background:#3C8DBC;height:30px;border-radius:5px;">
                <h3 class="panel-title text-center" style="line-height:30px;color:white;">用户信息 </h3>
            </div>
        
                <table class="table table-striped table-bordered">
                    <tbody><tr>
                    <td>用户账号:</td>
                    <td>用户手机:</td>
                    <td>用户邮箱:</td>
                    <td>注册IP:</td>
                    <td>注册时间:</td>
                   </tr>
                <tr>
                        <td><?= Html::encode($model->user->username);?></td>
                        <td><?= Html::encode($model->user->phone);?></td>
                        <td><?= Html::encode($model->user->email);?></td>
                        <td><?= Html::encode($model->user->reigster_ip);?></td>
                        <td><?= Html::encode($model->user->create_time);?></td>

                </tr>
                    </tbody>
                </table>
     



    






</div>
